package com.example.javaeefinal.Service.Imp;

import com.example.javaeefinal.Mapper.RoleMapper;
import com.example.javaeefinal.Service.RoleService;
import com.example.javaeefinal.pojo.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleMapper roleMapper;

    public Role getById(Integer id){
        return roleMapper.getById(id);
    }

    public Role getByName(String name){
        return roleMapper.getByName(name);
    }

    public List<Role> getAll(){
        return roleMapper.getAll();
    }

    public boolean add(String name){
        return roleMapper.add(name)>0;
    }

    public boolean delete(Integer id){
        return roleMapper.delete(id)>0;
    }

    public boolean updateById(Integer id,String name){
        return roleMapper.updateById(id,name)>0;
    }
}
